{% extends "order/base.html" %}{% load i18n %} 
{% block title %}{% trans "Order View title" %} {{order.title}} {% endblock %}
{% block content %}
<div>
	{% if order %}
	<div class="box">
		<table>
			<tbody>
				<tr>
					<td>
						{% trans "Order product:" %}
					</td>
					<td>
						{{order.product.name}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "Order title:" %}
					</td>
					<td>
						{{order.title}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "Order minUserNum:" %}
					</td>
					<td>
						{{order.minUserNum}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "maxUserNum:" %}
					</td>
					<td>
						{{order.maxUserNum}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "minVendorNum:" %}
					</td>
					<td>
						{{order.minVendorNum}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "Order maxVendorNum:" %}
					</td>
					<td>
						{{order.maxVendorNum}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "Order proposalPrice:" %}
					</td>
					<td>
						{{order.proposalPrice}}
					</td>
				</tr>
				<tr>
					<td>
						{% trans "Order deadline:" %}
					</td>
					<td>
						{{order.deadline}}
					</td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="box">
		{% trans "Order Status:" %}<font color="red">{{order.get_status}}</font><br/>
		{% trans "Order User/Vendor:" %}
		<font color="red">{{order.order_user_size}}/{{order.order_vendor_size}}</font>
		{%if order.confirmTime%}{% trans "Order Confirm Time:" %}{{order.confirmTime}}{% endif %}
		{%if order.closeTime%}{% trans "Order Close Time:" %}{{order.closeTime}}{% endif %}
	</div>
	{%if order.is_joinable%}
	<div class="box">
		<!--  -->
		{% if user.is_common_user %} 
			{% if order_user %} 
				{% trans "You have joined in the group order!" %}
				<br>
				{% trans "view your" %}
				<a href="/addressbook/{{ order_user.address_book.id }}/"> {% trans "address book" %}</a>.
				<a href="/order/quit/{{ order.id }}/"> {% trans "quit order" %}</a>.
			{% else %}
				<a href="/order/user/handle/{{order.id}}/">{% trans "Join in" %}</a> {% trans "the group order." %}
				
			{% endif %}
			<!--  -->
			{%if order.is_handling %}
				<br/>{% trans "Vote vendor:" %}<br/>
				{%if order_user.has_voted %}
						{% trans "You have voted for this order!" %}
				{%endif%}
				
				{% for vendor in order.order_vendors %}
					{%ifequal vendor.id order_user.selected_vendor.id%}
						<font color="red"><b>{{vendor.company_name}}</b></font>
					{% else %}
						<a href="/order/vote/{{order.id}}/{{vendor.id}}/">{{vendor.company_name}}</a> 
					{%endifequal%} 
				{% endfor %}
			{%endif%} 
		{% endif %} 
		
		{% if user.is_company_user %} 
			{% if order_vendor %} 
				{% trans "You have joined in the group order!" %}
				<br>
				{% trans "view your" %}
				<a href="/company/edit/"> {% trans "company info" %}</a>.
				<!--  -->
			{% else %}
				<a href="/order/vendor/add/{{order.id}}/">{% trans "Join in" %}</a> {% trans "the group order." %}
				<!--  -->
			{% endif %} 
		{% endif %}
	</div>
	{%endif%}
	<div class="box">
		
		{%if order.is_inviting and order.is_belong%}
		<a href="/order/{{order.id}}/stop_inviting/">{% trans "Order Stop inviting" %}</a> 
		{%endif%} 
		
		{%if order.is_handling and order.is_belong%}
		<a href="/order/{{order.id}}/set_charging/">{% trans "Order Set to be charging" %}</a> 
		{%endif%} 
		
		{%if order.is_charging and order.is_belong%}
		 {% trans "Set to be" %}
		<a href="/order/{{order.id}}/success/">{% trans "Order Success" %}</a> {% trans "or" %}
		<a href="/order/{{order.id}}/failed/">{% trans "Order Failed" %}</a> 
		{%endif%}
		
		{%if order.is_cancelable %} {% trans "Your can" %}
		<a href="/order/{{order.id}}/cancel/"> {% trans "Order cancel" %}</a> {% trans "the group order." %}
		{%endif%} 
	</div>

	<!-- end order -->
	{% endif %}

</div>
{% endblock %}
